package com.ruoyi.hire.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.wf.captcha.GifCaptcha;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;

import java.io.IOException;
import java.util.concurrent.TimeUnit;
//import com.ruoyi.hire.service.ICompanyService;

/**
 * 用人单位 Controller
 * 为就业网前端提供数据
 *
 * @author linyang
 * @date 2025-07-20
 */
@RestController
@RequestMapping("/site/hire/company")
public class CompanyController extends BaseController {
//    @Resource
//    private ICompanyService companyService;

    @Resource
    private RedisCache redisCache;


    private static final String COMPANY_CAPTCHA_CODE_KEY = "captcha_codes:";


//    @RequestMapping("/captchaImage")
//    public AjaxResult getCode(HttpServletRequest request, HttpServletResponse response) throws IOException {
//        AjaxResult ajax = AjaxResult.success();
//        // 创建GifCaptcha对象
//        GifCaptcha gifCaptcha = new GifCaptcha(120, 38, 4);
//        // 输出验证码图片
//        //CaptchaUtil.out(gifCaptcha, request, response);
//        // 获取验证码文本
//        String verCode = gifCaptcha.text().toLowerCase();
//        // 保存验证码信息
//        String uuid = IdUtils.simpleUUID();
//        String verifyKey = COMPANY_CAPTCHA_CODE_KEY + uuid;
//        redisCache.setCacheObject(verifyKey, verCode, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
//        ajax.put("uuid", uuid);
//        ajax.put("img", gifCaptcha.toBase64());
//        return AjaxResult.success(ajax);
//
//    }



}
